﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;

namespace HYRElectric.EquipmentPlace
{
	public class EmergencyLightFilter : ISelectionFilter
	{
		public bool AllowElement(Element elem)
		{
			if (!(elem is FamilyInstance))
			{
				return false;
			}
            if (elem.Category.Id.IntegerValue != (int)BuiltInCategory.OST_LightingFixtures)
			{
				return false;
			}
			FamilyInstance familyInstance = elem as FamilyInstance;
			string familyName = familyInstance.Symbol.FamilyName;
            return !string.IsNullOrEmpty(familyName) && (familyInstance.Category.Id.IntegerValue != (int)BuiltInCategory.OST_LightingFixtures || familyName.Contains(EmergencyLightFilter.m_strFamilyName));
		}

		public bool AllowReference(Reference refer, XYZ pos)
		{
			return false;
		}

		private static string m_strFamilyName = "安全出口";
	}
}
